#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

struct TreeNode {
    int val;
    struct TreeNode *left;
    struct TreeNode *right;
};
 
int countNodes(struct TreeNode* root)
{
    return root == NULL ? 0 : countNodes(root->left) + countNodes(root->right) + 1;
}